package com.note.androidapplication;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;

import com.idlefish.flutterboost.FlutterBoost;
import com.idlefish.flutterboost.FlutterBoostRouteOptions;
import com.note.androidapplication.databinding.ActivityMainBinding;

import java.util.HashMap;

public class MainActivity extends AppCompatActivity {
    private ActivityMainBinding activityMainBinding;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        activityMainBinding = ActivityMainBinding.inflate(getLayoutInflater());
        setContentView(activityMainBinding.getRoot());
        try {
            initView();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    void initView() throws InterruptedException {
        activityMainBinding.toFlutter.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                FlutterBoostRouteOptions options = new FlutterBoostRouteOptions.Builder()
                        .pageName("mainPage")
                        .arguments(new HashMap<>())
                        .requestCode(111)
                        .build();
                FlutterBoost.instance().open(options);
            }
        });
    }
}